#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <iostream>
#include <cstring>
#include <QMainWindow>
/*
 * 任务栏1中订单管理需要的数据库，暂时使用链表实现
 * 可提升：使用红黑树，有时间在搞
 */
struct order_for_goods
{
    char good_name[50];
    char good_price[50];
    char order_ID[20];
    char sent_addr[100];
    struct order_for_goods *next;
    order_for_goods(const char *g_n, const char *g_p, const char *o_I, const char *s_a) {
        strcpy(this->good_name, g_n);
        strcpy(this->good_price, g_p);
        strcpy(this->order_ID, o_I);
        strcpy(this->sent_addr, s_a);
        this->next = NULL;
    }
};

struct goods_info{
    char good_name[50];
    char good_id[100];
    int stock;
    int sold;
    double prev_price;
    double now_price;
    double discount;
    struct goods_info *next;

    goods_info(const char *g_n, const char *g_i, int st, int sd, double prp, double np, double disc){
        std::strcpy(this->good_name, g_n);
        std::strcpy(this->good_id, g_i);
        this->stock = st;
        this->sold = sd;
        this->prev_price = prp;
        this->now_price = np;
        this->discount = disc;
        this->next = NULL;
    }
};
struct logistic_info{
    char order_id[20];
    char logistic_id[20];
    char Courier_company[20];
    char now_addr[100];
    char label[5];
    struct logistic_info *next;

    logistic_info(const char *oi, const char *li, const char *cc, const char *na, const char *lb){
        std::strcpy(this->order_id, oi);
        std::strcpy(this->logistic_id, li);
        std::strcpy(this->Courier_company, cc);
        std::strcpy(this->now_addr, na);
        std::strcpy(this->label, lb);
        this->next = NULL;
    }
};

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
